<template lang="html">
    <div class="box">
        <div class="header">
            <el-form class="filterCondition demo-form-inline" :inline="true" label-width="80px">
                <el-select v-model="selectValue" placeholder="请选择">
                    <el-option label="全部" value=""></el-option>
                    <el-option  v-for="item,k in options" :key="k" :label="item.type" :value="item.type"></el-option>
                </el-select>
                <el-form-item label="发布时间" style="margin-bottom: 0;width: 520px;">
                    <el-date-picker v-model="intervalTime" type="daterange" align="right" unlink-panels range-separator="-"
                      start-placeholder="开始日期" end-placeholder="结束日期" style="width: 100%;"
                      value-format="yyyy-MM-dd HH:mm:ss" >
                    </el-date-picker>
                </el-form-item>
                <el-form-item>
                    <el-button  style="width: 120px;background-color:#3498E9;color:#fff" @click="search()">搜索</el-button>
                </el-form-item>
            </el-form>
        </div>

        <div class="body">
          <el-table :data="tableData.list" style="width: 100%">
              <el-table-column  prop="type" align="center" label="类型" ></el-table-column>
              <el-table-column  prop="credit_time"  align="center" label="时间" ></el-table-column>
              <el-table-column  prop="message"  align="center" label="内容" ></el-table-column>
          </el-table>
        </div>

        <div class="page_box">
            <el-pagination class="page" layout="prev, pager, next"
              @current-change="changePage" :current-page="currentPage" :page-count='tableData.rows' >
            </el-pagination>
        </div>

    </div>
</template>

<script>
export default {
  data(){
    return {
        selectValue: '',
        options: [],
        tableData: [],
        intervalTime: [],
        currentPage:1
    }
  },
  created(){
    this.logType()
    this.complainadminLog()
  },
  methods:{
    search(){
      this.complainadminLog()
    },
    complainadminLog(page=1){
        this.currentPage = page;
        this.$http4.complainadminLog({
          key: this.selectValue,
          page: page,
          start_time: (this.intervalTime && this.intervalTime[0]) || '',
          end_time: (this.intervalTime && this.intervalTime[1]) || ''
        }).then(res=>{
          this.tableData = res.data.code == 1 ?
          res.data.data : []
        })
    },
    logType(){
      this.$http4.logType().then(res=>{
        this.options = res.data.code == 1?
        res.data.data: []
      })
    },


    changePage(e){
        this.complainadminLog(e)
    }

  }
}
</script>

<style lang="css" scoped>
@import "../../my-style/app.css";
/deep/ .el-input-group__append, .el-input-group__prepend{
  background-color: #3498E9;
  border: none;
  color: white;
}
.page_box{
  text-align: center;
}
</style>
